﻿//Copyright (c) 2010 William Liu, Enoch Ye
//William Liu <william.lyz@gmail.com>
//Enoch Ye <moonlight.enoch@gmail.com>

//   Licensed under the Apache License, Version 2.0 (the "License");
//   you may not use this file except in compliance with the License.
//   You may obtain a copy of the License at

//       http://www.apache.org/licenses/LICENSE-2.0

//   Unless required by applicable law or agreed to in writing, software
//   distributed under the License is distributed on an "AS IS" BASIS,
//   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//   See the License for the specific language governing permissions and
//   limitations under the License.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace GBG_DBM.GlobalParameters
{
    public static class GlobalParams
    {
        #region FILEDS

        private static bool _isLogined = false;
        private static string _dbPath = Directory.GetCurrentDirectory() +  "\\Database\\Database.accdb";
        private static string _currentPath;
        private static string _defaultBackupPath;
        private static string _iniFileName;
        private static string _encryptKey = "WL92aM4e";

        //for dataset
        private static string _productID = "[STD QTY].Product_ID";

        #endregion

        #region PROPERTIES

        public static bool GetLoginState { get { return _isLogined; } }
        public static string DBPath { get { return _dbPath; } }
        //public static string CurrentPath { get { return _currentPath; } }
        public static string EncryptKey { get { return _encryptKey; } }
        public static string ProductID { get { return _productID; } }

        #endregion

        #region CONSTRUCTORS
        #endregion

        #region METHODS

        public static bool IsLogined { set { _isLogined = value; } }
        //public static string SetDBPath {set {_dbPath = value; } }

        //get current app directory path
        public static string GetCurrentPath()
        {
            _currentPath = System.IO.Directory.GetCurrentDirectory();
            return _currentPath;
        }

        //get defult backup directory path
        public static string DefaultBackupPath()
        {
            _defaultBackupPath = System.IO.Directory.GetCurrentDirectory().ToString() + "\\Backup";
            return _defaultBackupPath;
        }

        //get ini file info, which is application configuration file path and file name
        public static string INIFilePath()
        {
            _iniFileName = System.IO.Directory.GetCurrentDirectory().ToString() + "setting.ini";
            return _iniFileName;
        }

        #region Dataset related
        /// <summary>
        /// Set View tables' product id
        /// for the reporting data tables
        /// </summary>
        /// <param name="ID">Set a product id for queries</param>
        public static void SetProductID(string ID)
        {
            _productID = ID;
        }

        #endregion


        #endregion
    }
}
